package com.llmcu.graphic.designpatterns.mediator;

import javafx.scene.control.PasswordField;

import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.event.TextEvent;
import java.awt.event.TextListener;

/**
 * xxxx
 *
 * @author liuling
 * @date 2024/7/21 10:54
 */
public class LoginPasswordField extends JPasswordField implements Colleague, DocumentListener {
    public LoginPasswordField(int columns) {
        super(columns);
    }

    private Mediator mediator;

    @Override
    public void setMediator(Mediator mediator) {
        this.mediator= mediator;
    }

    @Override
    public void insertUpdate(DocumentEvent e) {
        mediator.colleagueChanged();
    }

    @Override
    public void removeUpdate(DocumentEvent e) {
        mediator.colleagueChanged();
    }

    @Override
    public void changedUpdate(DocumentEvent e) {
        mediator.colleagueChanged();

    }
}
